package com.viphuli.http.handler;

import com.offroader.pay.PayResultListener;
import com.offroader.pay.alipay.AlipayPayHelper;
import com.offroader.utils.ViewUtils;
import com.viphuli.fragment.PurchaseOrderPayFragment;
import com.viphuli.http.bean.page.PurchaseOrderPayPage;
import com.viphuli.http.bean.part.PurchasePayInfo;

public class PurchaseOrderPayAlipayResponseHandler extends MyBaseHttpResponseHandler<PurchaseOrderPayFragment, PurchaseOrderPayPage> {

	@Override
	public void deal() {
		PurchasePayInfo payInfo = page.getPayInfo();

		if (payInfo != null && payInfo.getAlipay() != null) {

			AlipayPayHelper.getInstance().pay(caller.getActivity(), payInfo.getAlipay().getOrderInfo(), new PayResultListener() {

				@Override
				public void onPaySuccess() {
					caller.goToPayResultSuccess();
				}

				@Override
				public void onPayFails() {
					caller.goToPayResultFails();
				}
			});

		} else {
			ViewUtils.toast("订单支付信息为空");
		}
	}

}
